//
//  Check.m
//  Learncloud
//
//  Created by 郭明皓 on 16/6/20.
//  Copyright © 2016年 郭明皓. All rights reserved.
//

#import "Check.h"

@implementation Check

+ (NSString *)checkPassword:(NSString *)aPassword
{
    if (aPassword.length == 0) {
        return @"请输入密码";
    }
    if ( aPassword.length < 6 | aPassword.length > 16) {
        return @"密码长度应在6-16位，且不能含汉字或空格";
    }
    return  nil;
}

+ (NSString *)checkMobile:(NSString *)aMobile
{
    if ( aMobile.length == 0 ) {
        return @"请输入手机号";
    }
    if (aMobile.length != 11) {
        return @"请输入正确的手机号";
    }
    NSString *firstLetter = [aMobile substringToIndex:2];
    if (![firstLetter isEqualToString:@"15"] &&
        ![firstLetter isEqualToString:@"13"] &&
        ![firstLetter isEqualToString:@"18"] &&
        ![firstLetter isEqualToString:@"14"] &&
        ![firstLetter isEqualToString:@"17"])
    {
        return @"请输入正确的手机号";
    }
    return nil;
}

+(NSString *)checkVerifyCode:(NSString *)verifyCode{
    if(verifyCode.length == 0){
        return @"请输入验证码";
    }
    if(verifyCode.length != 6){
        return @"请输入正确的验证码";
    }
    
    return nil;
}

+(void)showAlertWithString:(NSString *)message{
//    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:message delegate:nil  cancelButtonTitle:nil otherButtonTitles:nil];
//    [alert show];
    
//    [self performSelector:@selector(dimissAlert:) withObject:alert afterDelay:2.0];
}


@end
